package cn.ym.aircraft;

import java.awt.*;
import java.awt.image.BufferedImage;

public class Sky extends FlyingObject {
    private int y1; //第二张图片的Y坐标

    Sky() {
        super(World.WIDTH, World.HEIGHT, 8, 0, 0);
        y1 = -World.HEIGHT;
    }

    public void step() {
        this.y += this.speed;
        this.y1 += this.speed;
        if (this.y >= World.HEIGHT) {
            this.y = -World.HEIGHT;
        }
        if (this.y1 >= World.HEIGHT) {
            this.y1 = -World.HEIGHT;
        }

    }

    @Override
    public BufferedImage getImage() {
        return Images.sky;
    }

    @Override
    public void paintImage(Graphics g) {
        super.paintImage(g);
        g.drawImage(getImage(),this.x,this.y1,null);
    }
}
